
module ArtOfRails
  module Rdf
    class Namespaces    
      @@namespaces = {
        :rdf => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
        :rdfs => 'http://www.w3.org/2000/01/rdf-schema#',
        :owl => 'http://www.w3.org/2002/07/owl#',
        :xsd => 'http://www.w3.org/2001/XMLSchema#',
        :foaf => 'http://xmlns.com/foaf/0.1/'        
      }
            
      def self.register(prefix, baseuri)
        @@namespaces[prefix] = baseuri
      end
      
      def self.fetch_uri(prefix)
        @@namespaces[prefix]
      end
      
      def self.fetch_prefix(baseuri)
        @@namespaces.each do | prefix, uri |
          return prefix if(uri == baseuri)
        end
        return nil
      end
      
      def self.prefix_defined?(prefix)
        @@namespace.has_key?(prefix)
      end
      
      def self.uri_defined?(baseuri)
        @@namespace.has_value?(prefix)
      end
      
      def self.hash
        @@namespaces
      end

    end
  end
end